Ubuntu 15.04
Sponsored Link

Configure iSCSI Initiator
2015/05/06
 
Configure iSCSI Initiator.
This example is based on the environment below.
+----------------------+          |          +----------------------+
| [   iSCSI Target   ] |10.0.0.30 | 10.0.0.31| [ iSCSI Initiator  ] |
|     dlp.srv.world    +----------+----------+   client.srv.world   |
|                      |                     |                      |
+----------------------+                     +----------------------+

[1] Configure iSCSI Initiator.
root@client:~#
apt-get -y install open-iscsi
root@client:~#
vi /etc/iscsi/iscsid.conf
# line 53: uncomment

node.session.auth.authmethod = CHAP
# line 57,58: uncomment and set username and password which set on iSCSI Target

node.session.auth.username =
username

node.session.auth.password =
password
root@client:~#
systemctl restart open-iscsi
# discover target

root@client:~#
iscsiadm -m discovery -t sendtargets -p 10.0.0.30

10.0.0.30:3260,1 iqn.2015-05.world.srv:target00
# confirm status after discovery

root@client:~#
iscsiadm -m node -o show

# BEGIN RECORD 2.0-873
node.name = iqn.2015-05.world.srv:target00
node.tpgt = 1
node.startup = manual
node.leading_login = No
.....
.....
# login to target

root@client:~#
iscsiadm -m node --login

Logging in to [iface: default, target: iqn.2015-05.world.srv:target00, portal: 10.0.0.30,3260] (multiple)
Login to [iface: default, target: iqn.2015-05.world.srv:target00, portal: 10.0.0.30,3260] successful.
# confirm established session

root@client:~#
iscsiadm -m session -o show

tcp: [1] 10.0.0.30:3260,1 iqn.2015-05.world.srv:target00
# confirm partitions

root@client:~#
cat /proc/partitions

major minor  #blocks  name

   2        0          4 fd0
   8        0  157286400 sda
   8        1     248832 sda1
   8        2          1 sda2
   8        5  157034496 sda5
 252        0  148639744 dm-0
 252        1    8384512 dm-1
  11        0    1048575 sr0
   8       16   83886080 sdb
# added new device provided from target as [sdb]

[2] It's possible to use iSCSI device like follows.
root@client:~#
apt-get -y install parted
# create a label

root@client:~#
parted --script /dev/sdb "mklabel msdos"

# create a partition

root@client:~#
parted --script /dev/sdb "mkpart primary 0% 100%"

# format with EXT4

root@client:~#
mkfs.ext4 /dev/sdb1
# mount

root@client:~#
mount /dev/sdb1 /mnt

root@client:~#
df -hT

Filesystem               Type      Size  Used Avail Use% Mounted on
udev                     devtmpfs  3.9G     0  3.9G   0% /dev
tmpfs                    tmpfs     797M  8.9M  788M   2% /run
/dev/mapper/dlp--vg-root ext4      140G  1.7G  131G   2% /
tmpfs                    tmpfs     3.9G     0  3.9G   0% /dev/shm
tmpfs                    tmpfs     5.0M     0  5.0M   0% /run/lock
tmpfs                    tmpfs     3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/sda1                ext2      236M   74M  150M  33% /boot
tmpfs                    tmpfs     797M     0  797M   0% /run/user/0
/dev/sdb1                ext4       79G   56M   75G   1% /mnt
 
Tweet